<template>
  <div class="not-found">
    <div class="error-container">
      <el-result
        icon="el-icon-warning"
        title="404 页面不存在"
        sub-title="抱歉，您访问的页面不存在或已被移除"
      >
        <template #extra>
          <el-button type="primary" @click="goHome">返回首页</el-button>
          <el-button @click="goBack">返回上一页</el-button>
        </template>
      </el-result>
      
      <div class="suggestions">
        <h3>您可能想要访问：</h3>
        <div class="link-group">
          <el-button type="text" @click="router.push('/')">首页</el-button>
          <el-button type="text" @click="router.push('/dashboard')">仪表盘</el-button>
          <el-button type="text" @click="router.push('/users')">用户管理</el-button>
          <el-button type="text" @click="router.push('/products')">产品管理</el-button>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { useRouter } from 'vue-router'

const router = useRouter()

// 返回首页
const goHome = () => {
  router.push('/')
}

// 返回上一页
const goBack = () => {
  router.back()
}
</script>

<style scoped>
.not-found {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background-color: #f5f7fa;
  padding: 40px 20px;
}

.error-container {
  max-width: 600px;
  width: 100%;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  padding: 40px;
  animation: fadeIn 0.5s ease-out;
}

.suggestions {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid #ebeef5;
}

.suggestions h3 {
  margin-bottom: 20px;
  color: #303133;
  font-size: 16px;
}

.link-group {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
</style>